//package com.yuerenjf.yuerenjinfu.widget;
//
//import android.app.Dialog;
//import android.content.Context;
//import android.os.Bundle;
//import android.support.annotation.NonNull;
//import android.support.annotation.StyleRes;
//import android.view.Gravity;
//import android.view.View;
//import android.view.ViewGroup;
//import android.view.Window;
//import android.view.WindowManager;
//import android.widget.ImageView;
//
//import com.yuerenjf.yuerenjinfu.R;
//
//import java.util.HashMap;
//
//import cn.sharesdk.framework.Platform;
//import cn.sharesdk.framework.PlatformActionListener;
//import cn.sharesdk.framework.ShareSDK;
//import cn.sharesdk.sina.weibo.SinaWeibo;
//import cn.sharesdk.tencent.qq.QQ;
//import cn.sharesdk.tencent.qzone.QZone;
//import cn.sharesdk.wechat.friends.Wechat;
//import cn.sharesdk.wechat.moments.WechatMoments;
//
///**
// * Created by Administrator on 2017/4/27 0027.
// */
//
//public class ShareDialog extends Dialog implements View.OnClickListener {
//    private Context mContext;
//
//    private String title;
//    private String content;
//    private String imageUrl;
//    private String webUrl;
//    public ShareDialog(@NonNull Context context) {
//        super(context, R.style.myShareDialog);
//        this.mContext = context;
//        setCanceledOnTouchOutside(true);
//    }
//
//    public ShareDialog(@NonNull Context context, @StyleRes int themeResId) {
//        super(context, themeResId);
//    }
//
//
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.layout_shape_dialog);
//        ImageView shareQZone = (ImageView) findViewById(R.id.image_live_share_qzone);
//        ImageView shareQQ = (ImageView) findViewById(R.id.image_live_share_qq);
//        ImageView shareSina = (ImageView) findViewById(R.id.image_live_share_sina);
//        ImageView shareWechat = (ImageView) findViewById(R.id.image_live_share_wechat);
//        ImageView shareWechatMoment = (ImageView) findViewById(R.id.image_live_share_wechat_moment);
//        shareQZone.setOnClickListener(this);
//        shareQQ.setOnClickListener(this);
//        shareSina.setOnClickListener(this);
//        shareWechat.setOnClickListener(this);
//        shareWechatMoment.setOnClickListener(this);
//
//    }
//
//    public void setContent(String title,String text,String image,String webUrl){
//        this.title=title;
//        this.content=text;
//        this.imageUrl=image;
//        this.webUrl=webUrl;
//    }
//
//    @Override
//    public void onClick(final View v) {
//        switch (v.getId()) {
//            case R.id.image_live_share_qzone:
//                Platform.ShareParams sp = new Platform.ShareParams();
//                sp.setTitle(title);
//                sp.setText(content);
//                sp.setImageUrl(imageUrl);
//                sp.setSiteUrl(webUrl);
//                Platform qzone = ShareSDK.getPlatform(QZone.NAME);
//// 设置分享事件回调（注：回调放在不能保证在主线程调用，不可以在里面直接处理UI操作）
//                qzone.setPlatformActionListener(new PlatformActionListener() {
//                    public void onError(Platform arg0, int arg1, Throwable arg2) {
//                        //失败的回调，arg:平台对象，arg1:表示当前的动作，arg2:异常信息
//                    }
//
//                    public void onComplete(Platform arg0, int arg1, HashMap<String, Object> arg2) {
//                        //分享成功的回调
//                    }
//
//                    public void onCancel(Platform arg0, int arg1) {
//                        //取消分享的回调
//                    }
//                });
//// 执行图文分享
//                qzone.share(sp);
//                break;
//            case R.id.image_live_share_qq:
//                Platform.ShareParams spQQ = new Platform.ShareParams();
//                spQQ.setText(title);
//                spQQ.setTitle(title);
//                spQQ.setImageUrl(imageUrl);
//                Platform qq = ShareSDK.getPlatform(QQ.NAME);
//                qq.share(spQQ);
//                break;
//            case R.id.image_live_share_sina:
//                Platform.ShareParams spSina = new Platform.ShareParams();
//                spSina.setText(title);
//                spSina.setImageUrl(imageUrl);
//                spSina.setUrl(webUrl);
//                Platform weibo = ShareSDK.getPlatform(SinaWeibo.NAME);
//// 执行图文分享
//                weibo.share(spSina);
//                break;
//            case R.id.image_live_share_wechat:
//                //toast("wechat");
//                Platform.ShareParams spWechat = new Platform.ShareParams();
//                spWechat.setShareType(Platform.SHARE_WEBPAGE);
//                spWechat.setTitle(title);
//                spWechat.setImageUrl(imageUrl);
//                spWechat.setUrl(webUrl);
//                Platform wechat = ShareSDK.getPlatform(Wechat.NAME);
//// 执行图文分享
//                wechat.share(spWechat);
//
//
//                break;
//            case R.id.image_live_share_wechat_moment:
//                Platform.ShareParams spWechatMoment = new Platform.ShareParams();
//                spWechatMoment.setShareType(Platform.SHARE_WEBPAGE);
//                spWechatMoment.setTitle(title);
//                spWechatMoment.setImageUrl(imageUrl);
//                spWechatMoment.setUrl(webUrl);
//                Platform wechatMoment = ShareSDK.getPlatform(WechatMoments.NAME);
//                wechatMoment.share(spWechatMoment);
//                break;
//        }
//
//    }
//
//    public void showShareDialog() {
//        show();
//        Window dialogWindow = getWindow();
//        WindowManager.LayoutParams lp = dialogWindow.getAttributes();
//        dialogWindow.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
//        lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
//        lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
//        dialogWindow.setAttributes(lp);
//    }
//}
